Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
is-plain-obj
Advanced tools
The is-plain-obj package is a simple and lightweight npm package used to check if a given object is a plain object, that is, an object created by the Object constructor or one with a null prototype.
Check if an object is a plain object
This feature allows you to verify if a given object is a plain object. It returns true for objects created by the Object constructor or with a null prototype and false for all other types of objects, such as instances of custom classes or built-in JavaScript objects like Map.
const isPlainObj = require('is-plain-obj');
console.log(isPlainObj({foo: 'bar'})); // true
console.log(isPlainObj(new Map())); // false
Similar to is-plain-obj, is-plain-object checks if a given value is a plain object. However, it might have slightly different internal implementations or dependencies, potentially affecting its performance or compatibility in certain environments.
Part of the Lodash library, lodash.isplainobject offers similar functionality to is-plain-obj. Lodash is a more extensive utility library, so using this function might bring in more dependencies than needed if you're only interested in checking for plain objects.
Check if a value is a plain object
An object is plain if it's created by either {}
, new Object()
or Object.create(null)
.
$ npm install --save is-plain-obj
var isPlainObj = require('is-plain-obj');
isPlainObj({foo: 'bar'});
//=> true
isPlainObj([1, 2, 3]);
//=> false
MIT © Sindre Sorhus
FAQs
Check if a value is a plain object
The npm package is-plain-obj receives a total of 38,510,470 weekly downloads. As such, is-plain-obj popularity was classified as popular.
We found that is-plain-obj demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.